/*
 * @Author: yangrongxin
 * @Date: 2021-08-16 14:24:24
 * @LastEditors: yangrongxin
 * @LastEditTime: 2021-09-17 10:12:14
 */
import { View } from '@tarojs/components';
import Taro from '@tarojs/taro';
import { removeItemSync } from '@/utils/storage';
import { STORAGE_TYPE } from '@/const/dataDictionary';
import { UserInfoItem } from './components';
import styles from './index.module.less';

const MySetting = () => {
  // 退出登录
  const logout = () => {
    removeItemSync(STORAGE_TYPE.USERINFO);
    removeItemSync(STORAGE_TYPE.TEAMMAINUSER);
    removeItemSync(STORAGE_TYPE.ISLOGIN);
    Taro.reLaunch({
      url: '/pages/Home/index',
    });
  };

  return (
    <View className={styles.container}>
      <UserInfoItem title="关于" rightText={`版本号(${VERSION})`} />
      {/* <UserInfoItem
        title="帮助反馈"
        onClick={() => {
          // TODO: 第一期暂时不完成
          // Taro.navigateTo({
          //   url: '/pages/My/compoents/MySetting/components/HelpFeedback/index'
          // });
          Taro.showToast({
            title: '敬请期待',
            icon: 'none',
          });
        }}
      /> */}
      <UserInfoItem title="清空缓存并重新登录" onClick={logout} />
    </View>
  );
};

export default MySetting;
